function foo(){
    var myName = '小红'
    let test1 = 1
    let test2 = 2
    var innerBar = {
        getName: function(){
            console.log(test1)
            return myName;
        },
        setName: function(newName){
         myName = newName
        }
    }
    return innerBar
}

var bar = foo()
bar.setName('小明')
bar.getName() // 1
console.log(bar.getName())// 1 小明
